const TYPE_INT = 'int';
const TYPE_DOUBLE = 'double';
const TYPE_EXPRESSION = 'expression';
const TYPE_BOOL = 'bool';
const TYPE_TABULAR = 'tabular';
const TYPE_OPTION = 'option';
const TYPE_SET_NODE = 'Node';
const TYPE_SET_ELEMENT = 'Element';
const TYPE_SET_SURFACE = 'Surface';
const TYPE_SET_REFER_POINT = 'ReferPoint';
const TYPE_MATERIAL_SET = 'materialSet';
const TYPE_SURFACE_INTERACTION_SET = 'surfaceInteractionSet';
const TYPE_MULTI_SELECT_TREE = 'multiSelectTree';
const TYPE_DYNAMIC_TABLE = 'dynamicTable';
const TYPE_BOUNDARY_DISPLACEMENT = 'Boundary-DisplacementConstraint';
const TYPE_BOUNDARY_LOAD = 'Boundary-Load';
const TYPE_GEOMETRIES_NEXTMESH = 'nextmesh';
const TYPE_GROUP = 'group';

// JSON Form Format 保留字段
// 特殊字段
const Maskable = 'Maskable';
const EmitChange = 'EmitChange';
const HandleChange = 'HandleChange';
const AmcaxProp = 'AmcaxProp';
// JSON Form Format 保留字段数组
const JsonReservedFields = [AmcaxProp];

const KeyIsGlobal = 'isGlobal';
const KeySelectedEntities = 'SelectedEntities';
const KeyMeshingDim = 'MeshingDim';
const KeyEntityType = 'EntityType';

enum FormEventType {
  TypeChanged = 'TypeChanged',
}

interface IAmcaxPropCreatable {
  key: string; // 子对象的key
  onlyOne: boolean; // 是否只允许创建一个
}

interface IAmcaxProp {
  selfEditKey: string; // 自身可编辑的子对象key，为空字符串表示自身就是可编辑的formFormat
  autoCreateChild: boolean; // 是否自动创建子对象，不包括selfEditKey
  childCreatable: IAmcaxPropCreatable[]; // 可创建的子对象数组
  deletable: boolean; // 是否可删除
  flatChildren: boolean; // 是否展开子对象，在树上
  notListChildren: boolean; // 是否不显示子对象
  clickChildShowMe: boolean; // 是否点击子对象展示本身
  nameEditable: boolean; // 是否可以编辑名称
  showType: boolean; // 是否显示Type，暂时Type都不可修改
  onlyOne?: boolean; // TODO 目前是在这里，后期应当使用childCreatable来判断
}

const ARRAY_TYPES = [
  'Arrayd',
  'xArrayd',
  'Arrayi',
  'xArrayi',
  'Arrayb',
  'xArrayb',
  'ArrayUnoind',
  'xArrayUnoind',
  'ArrayUnoindNoTitle',
  'ArrayNoLabel',
];

const ENTITY_TYPE_VERTEX = 'Vertex';
const ENTITY_TYPE_FACE = 'Face';
const ENTITY_TYPE_EDGE = 'Edge';
const ENTITY_TYPE_VOLUME = 'Volume';
const ENTITY_TYPE_ALL = 'All';
type ENTITY_TYPE = 'Vertex' | 'Edge' | 'Face' | 'Volume' | 'All';
const ENTITY_TYPES = [
  ENTITY_TYPE_VERTEX,
  ENTITY_TYPE_EDGE,
  ENTITY_TYPE_FACE,
  ENTITY_TYPE_VOLUME,
  ENTITY_TYPE_ALL,
];
const ENTITY_SOURCE = ['Source', 'Master'],
  ENTITY_TARGET = ['Target', 'Slave'];
// 值类型，只需要知道值即可（没有单位的情况下）
const VALUE_TYPE = [
  ...ENTITY_TYPES,
  TYPE_DOUBLE,
  TYPE_INT,
  TYPE_BOOL,
  TYPE_MATERIAL_SET,
  TYPE_SURFACE_INTERACTION_SET,
  TYPE_MULTI_SELECT_TREE,
  TYPE_DYNAMIC_TABLE,
  TYPE_OPTION,
  TYPE_GROUP,
  TYPE_TABULAR,
  TYPE_EXPRESSION,
];
export {
  ARRAY_TYPES,
  AmcaxProp,
  ENTITY_SOURCE,
  ENTITY_TARGET,
  ENTITY_TYPES,
  ENTITY_TYPE_ALL,
  ENTITY_TYPE_EDGE,
  ENTITY_TYPE_FACE,
  ENTITY_TYPE_VERTEX,
  ENTITY_TYPE_VOLUME,
  EmitChange,
  FormEventType,
  HandleChange,
  JsonReservedFields,
  KeyEntityType,
  KeyIsGlobal,
  KeyMeshingDim,
  KeySelectedEntities,
  Maskable,
  TYPE_BOOL,
  TYPE_BOUNDARY_DISPLACEMENT,
  TYPE_BOUNDARY_LOAD,
  TYPE_DOUBLE,
  TYPE_DYNAMIC_TABLE,
  TYPE_EXPRESSION,
  TYPE_GEOMETRIES_NEXTMESH,
  TYPE_GROUP,
  TYPE_INT,
  TYPE_MATERIAL_SET,
  TYPE_MULTI_SELECT_TREE,
  TYPE_OPTION,
  TYPE_SET_ELEMENT,
  TYPE_SET_NODE,
  TYPE_SET_SURFACE,
  TYPE_SET_REFER_POINT,
  TYPE_SURFACE_INTERACTION_SET,
  TYPE_TABULAR,
  VALUE_TYPE,
};
export type { ENTITY_TYPE, IAmcaxProp, IAmcaxPropCreatable };
